//
//  MenuZxzsTableViewCell.m
//  土巴兔
//
//  Created by 千锋 on 16/1/8.
//  Copyright (c) 2016年 IOS1503薛凯. All rights reserved.
//

#import "MenuZxzsTableViewCell.h"
#import "Default.h"
#import "UIImageView+WebCache.h"
#import "MenuZxzsModel.h"
@implementation MenuZxzsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}
- (void)createUI{
    self.MoreButton=[[UIButton alloc] initWithFrame:CGRectMake(260, 10, 50, 20)];
    //[_MoreButton setBackgroundColor:[UIColor yellowColor]];
    [_MoreButton setTitle:@"更多" forState:UIControlStateNormal];
    [_MoreButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    _MoreButton.titleLabel.font=[UIFont systemFontOfSize:17];
    _MoreButton.alpha=0.8;
    [_MoreButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -20, 0, 0)];
    [_MoreButton setImage:[UIImage imageNamed:@"btn_content_arrow_right_gray"] forState:UIControlStateNormal];
    [_MoreButton setImageEdgeInsets:UIEdgeInsetsMake(0, 40, 0, 0)];
    [self.contentView addSubview:_MoreButton];
    
    self.cellLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 10, DEVICEWIDTH-10, 20)];
    self.cellLabel.text=@"装修知识";
    [self.contentView addSubview:_cellLabel];
    
    self.topImageview=[[UIImageView alloc] initWithFrame:CGRectMake(10, 40, 100, 65)];
    _topImageview.layer.borderWidth=0.2;
    [self.contentView addSubview:_topImageview];
    
    self.topTitle=[[UILabel alloc] initWithFrame:CGRectMake(115, 40, 200, 20)];
    _topTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_topTitle];
    
    self.topPage_description=[[UILabel alloc] initWithFrame:CGRectMake(115, 62, 200, 45)];
    _topPage_description.numberOfLines=0;
    _topPage_description.font=[UIFont systemFontOfSize:14];
    _topPage_description.alpha=0.8;
    [self.contentView addSubview:_topPage_description];
    
    self.bottomImageview=[[UIImageView alloc] initWithFrame:CGRectMake(10, 120, 100, 65)];
     _bottomImageview.layer.borderWidth=0.2;
    [self.contentView addSubview:_bottomImageview];
    
    self.bottomTitle=[[UILabel alloc] initWithFrame:CGRectMake(115, 120, 200, 20)];
    _bottomTitle.font=[UIFont systemFontOfSize:16];
    [self.contentView addSubview:_bottomTitle];
    
    self.bottomPage_description=[[UILabel alloc] initWithFrame:CGRectMake(115, 147, 200, 45)];
    _bottomPage_description.numberOfLines=0;
    _bottomPage_description.font=[UIFont systemFontOfSize:14];
    _bottomPage_description.alpha=0.8;
    [self.contentView addSubview:_bottomPage_description];
}
- (void)relayoutWithData:(NSMutableArray*)arr{
    for (int i=0; i<arr.count; i++) {
        if (i==0) {
            [self.topImageview sd_setImageWithURL:[NSURL URLWithString:((MenuZxzsModel*)arr[i]).imgurl]];
            self.topTitle.text=((MenuZxzsModel*)arr[i]).title;
            self.topPage_description.text=((MenuZxzsModel*)arr[i]).page_description;
        }else{
            [self.bottomImageview sd_setImageWithURL:[NSURL URLWithString:((MenuZxzsModel*)arr[i]).imgurl]];
            self.bottomTitle.text=((MenuZxzsModel*)arr[i]).title;
            self.bottomPage_description.text=((MenuZxzsModel*)arr[i]).page_description;
        }
    }
    
    
}
@end
